home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / src / flex-238 / makefile < prev    next >
Encoding:
Makefile  |  1993-05-30  |  5.0 KB  |  192 lines

  1. # make file for "flex" tool
  2.  
  3. # @(#) $Header: /usr/fsys/odin/a/vern/flex/RCS/Makefile,v 2.9 90/05/26 17:28:44 vern Exp $ (LBL)
  4.  
  5. # Porting considerations:
  6. #
  7. #    For System V Unix machines, add -DUSG to CFLAGS (if it's not
  8. #         automatically defined)
  9. #    For Vax/VMS, add "-DVMS -DUSG" to CFLAGS.
  10. #    For MS-DOS, add "-DMS_DOS -DUSG" to CFLAGS.  Create \tmp if not present.
  11. #         You will also want to rename flex.skel to something with a three
  12. #         character extension, change SKELETON_FILE below appropriately,
  13. #      See MSDOS.notes for more info.
  14. #    For Amiga, add "-DAMIGA -DUSG" to CFLAGS.
  15. #    For SCO Unix, add "-DSCO_UNIX" to CFLAGS.
  16. #
  17. #    For C compilers which don't know about "void", add -Dvoid=int to CFLAGS.
  18. #
  19. #    If your C compiler is ANSI standard but does not include the <stdlib.h>
  20. #    header file (some installations of gcc have this problem), then add
  21. #    -DDONT_HAVE_STDLIB_H to CFLAGS.
  22. #
  23. # By default, flex will be configured to generate 8-bit scanners only
  24. # if the -8 flag is given.  If you want it to always generate 8-bit
  25. # scanners, add "-DDEFAULT_CSIZE=256" to CFLAGS.  Note that doing
  26. # so will double the size of all uncompressed scanners.
  27. # If on your system you have trouble building flex due to 8-bit
  28. # character problems, remove the -8 from FLEX_FLAGS and the
  29. # "#define FLEX_8_BIT_CHARS" from the beginning of flexdef.h.
  30.  
  31.  
  32. # the first time around use "make first_flex"
  33.  
  34.  
  35. # Installation targeting.  Files will be installed under the tree rooted
  36. # at DESTDIR.  User commands will be installed in BINDIR, library files
  37. # in LIBDIR (which will be created if necessary), auxiliary files in
  38. # AUXDIR, manual pages will be installed in MANDIR with extension MANEXT.
  39. # Raw, unformatted troff source will be installed if INSTALLMAN=man, nroff
  40. # preformatted versions will be installed if INSTALLMAN=cat.
  41. DESTDIR =
  42. BINDIR = /usr/local
  43. LIBDIR = /usr/local/lib
  44. AUXDIR = /usr/local/lib
  45. MANDIR = /usr/man/manl
  46. MANEXT = l
  47. INSTALLMAN = man
  48.  
  49. # MAKE = make
  50.  
  51.  
  52. SKELETON_FILE = $(DESTDIR)$(AUXDIR)/flex.skel
  53. SKELFLAGS = -DDEFAULT_SKELETON_FILE=\"$(SKELETON_FILE)\"
  54. CFLAGS = -O
  55. LDFLAGS = -s
  56.  
  57. COMPRESSION =
  58. FLEX_FLAGS = -ist8 -Sflex.skel
  59. # which "flex" to use to generate scan.c from scan.l
  60. FLEX = ./flex
  61. # CC = cc
  62.  
  63. AR = ar
  64. RANLIB = ranlib
  65.  
  66. FLEXOBJS = \
  67.     ccl.o \
  68.     dfa.o \
  69.     ecs.o \
  70.     gen.o \
  71.     main.o \
  72.     misc.o \
  73.     nfa.o \
  74.     parse.o \
  75.     scan.o \
  76.     sym.o \
  77.     tblcmp.o \
  78.     yylex.o
  79.  
  80. FLEX_C_SOURCES = \
  81.     ccl.c \
  82.     dfa.c \
  83.     ecs.c \
  84.     gen.c \
  85.     main.c \
  86.     misc.c \
  87.     nfa.c \
  88.     parse.c \
  89.     scan.c \
  90.     sym.c \
  91.     tblcmp.c \
  92.     yylex.c
  93.  
  94. FLEX_LIB_OBJS = \
  95.     libmain.o
  96.  
  97. FLEXLIB = flexlib.a
  98.  
  99.  
  100. all : flex $(FLEXLIB)
  101.  
  102. flex : $(FLEXOBJS)
  103.     $(CC) $(CFLAGS) -o flex $(LDFLAGS) $(FLEXOBJS)
  104.  
  105. first_flex:
  106.     cp initscan.c scan.c
  107.     $(MAKE) $(MFLAGS) flex
  108.  
  109. parse.h parse.c : parse.y
  110.     $(YACC) -d parse.y
  111.     @sed "/extern char.*malloc/d" <parse_tab.c >parse.c
  112.     @rm -f parse_tab.c
  113.     @mv parse_tab.h parse.h
  114.  
  115. scan.c : scan.l
  116.     $(FLEX) $(FLEX_FLAGS) $(COMPRESSION) scan.l >scan.c
  117.  
  118. scan.o : scan.c parse.h flexdef.h
  119.  
  120. main.o : main.c flexdef.h
  121.     $(CC) $(CFLAGS) -c $(SKELFLAGS) main.c
  122.  
  123. ccl.o : ccl.c flexdef.h
  124. dfa.o : dfa.c flexdef.h
  125. ecs.o : ecs.c flexdef.h
  126. gen.o : gen.c flexdef.h
  127. misc.o : misc.c flexdef.h
  128. nfa.o : nfa.c flexdef.h
  129. parse.o : parse.c flexdef.h
  130. sym.o : sym.c flexdef.h
  131. tblcmp.o : tblcmp.c flexdef.h
  132. yylex.o : yylex.c flexdef.h
  133.  
  134. flex.man : flex.1
  135.     nroff -man flex.1 >flex.man
  136.  
  137. $(FLEXLIB) : $(FLEX_LIB_OBJS)
  138.     $(AR) cru $(FLEXLIB) $(FLEX_LIB_OBJS)
  139.  
  140. lint : $(FLEX_C_SOURCES)
  141.     lint $(FLEX_C_SOURCES) > flex.lint
  142.  
  143. distrib :
  144.     mv scan.c initscan.c
  145.     chmod 444 initscan.c
  146.     $(MAKE) $(MFLAGS) clean
  147.  
  148. install: flex $(DESTDIR)$(LIBDIR) flex.skel install.$(INSTALLMAN) install-lib
  149.     install -s -m 755 flex $(DESTDIR)$(BINDIR)/flex
  150.     install -c -m 644 flex.skel $(SKELETON_FILE)
  151.  
  152. install-lib: $(DESTDIR)$(LIBDIR) $(FLEXLIB)
  153.     install -c -m 644 $(FLEXLIB) $(DESTDIR)$(LIBDIR)/libfl.a
  154.     $(RANLIB) $(DESTDIR)$(LIBDIR)/libfl.a
  155.  
  156. $(DESTDIR)$(LIBDIR):
  157.     mkdir $@
  158.  
  159. install.man: flex.1 flexdoc.1
  160.     install -c -m 644 flex.1 $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  161.     install -c -m 644 flexdoc.1 $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT)
  162.  
  163. install.cat: flex.1 flexdoc.1
  164.     nroff -h -man flex.1 > $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  165.     nroff -h -man flexdoc.1 > $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT)
  166.     chmod 644 $(DESTDIR)$(MANDIR)/flex.$(MANEXT)
  167.     chmod 644 $(DESTDIR)$(MANDIR)/flexdoc.$(MANEXT)
  168.  
  169. clean :
  170.     rm -f core errs flex *.o parse.c *.lint parse.h flex.man tags \
  171.         $(FLEXLIB)
  172.  
  173. tags :
  174.     ctags $(FLEX_C_SOURCES)
  175.  
  176. vms :    flex.man
  177.     $(MAKE) $(MFLAGS) distrib
  178.  
  179. test : flex
  180.     ./flex $(FLEX_FLAGS) $(COMPRESSION) scan.l | diff scan.c -
  181.  
  182. bigtest :
  183.     rm -f scan.c ; $(MAKE) COMPRESSION="-C" test
  184.     rm -f scan.c ; $(MAKE) COMPRESSION="-Ce" test
  185.     rm -f scan.c ; $(MAKE) COMPRESSION="-Cm" test
  186.     rm -f scan.c ; $(MAKE) COMPRESSION="-Cfe" test
  187.     rm -f scan.c ; $(MAKE) COMPRESSION="-CFe" test
  188.     rm -f scan.c ; $(MAKE) COMPRESSION="-Cf" test
  189.     rm -f scan.c ; $(MAKE) COMPRESSION="-CF" test
  190.     rm -f scan.c ; $(MAKE)
  191.